import http from '@/utils/http'

export default {
  async getUser(id) {
    return await http.get(`user/${id}`)
  },
  // 获取用户列表
  async getUserList(listQuery) {
    return await http.get('users', listQuery)
  },
  // 更新用户
  async updateUser(user) {
    return await http.patch('user', user)
  },
  // 新建用户
  async createUser(user) {
    return await http.post('user', user)
  },
  // 获取角色列表
  async getRoleList(user_id) {
    const query = {
      userId: user_id
    }
    return await http.get(`roles`, query)
  }
}
